/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.chl.da.pagebeans;

import edu.chl.da.ejb.core.Destination;
import edu.chl.da.ejb.ctrl.IManageDestination;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.model.SelectItem;

/**
 *
 * @author Erik
 */
@ManagedBean(name="AddAirportModel")
@RequestScoped
public class AddAirportModel {

    @EJB
    IManageDestination imd;

    /** Creates a new instance of AddAirplaneModel */
    public AddAirportModel() {
    }

    public SelectItem[] getDataList(){
        List<Destination> tmpDestinationList = imd.getAllDestinations();
        List dataList = new ArrayList();
        int i = 0;
        for(Destination d : tmpDestinationList) {
            dataList.add(new SelectItem(Integer.valueOf(i),d.getName()));
            i++;
        }
        return (SelectItem[]) dataList.toArray(new SelectItem[0]);
    }

}
